;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-

;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; Name:          conditions.lisp
;;;; Purpose:       cl-audioscrobbler conditions.
;;;; Programmer:    Nicolas Lamirault <nicolas.lamirault@gmail.com>
;;;;
;;;; This file, part of cl-audioscrobbler, is Copyright (c) 2007 by Nicolas Lamirault
;;;;
;;;; cl-audioscrobbler users are granted the rights to distribute and use this software
;;;; as governed by the terms of the MIT License :
;;;; http://www.opensource.org/licenses/mit-license.php
;;;;
;;;; *************************************************************************


(in-package :cl-audioscrobbler)



(define-condition audioscrobbler-error (simple-error)
  ()
  (:documentation "Main Audioscrobbler error."))



(define-condition audioscrobble-request-error (audioscrobbler-error)
  ((code :reader code
         :initarg :code
         :documentation "The error code.")
   (message :reader message
            :initarg :message
            :documentation "Explanation message."))
  (:documentation "Audioscrobbler request error.")
  (:report (lambda (condition stream)
             (format stream "Audioscrobbler error ~A : ~A."
                     (code condition) (message condition)))))


(define-condition audioscrobbler-protocol-error (audioscrobbler-error)
  ((message :reader message
            :initarg :message
            :documentation "Explanation message."))
  (:documentation "Audioscrobbler protocol error.")
  (:report (lambda (condition stream)
             (format stream "Audioscrobbler Protocol error : ~A."
                     (message condition)))))

